<?php if(!defined('BASEPATH')) exit('No direct script access allowed!');

class Test_Student_Skip_Model extends MY_Model {
	protected $_table_name = 'test_student_skip';

	public function __construct() {
		parent::__construct();
	}	
		
	public function get_total_skip_student($test_id, $nis){
		$this->db->where('test_id', $test_id);
		$this->db->where('nis', $nis);
		$rs = $this->db->get($this->_table_name)->result_array();
		if(isset($rs[0]))
			return $rs[0]['total_skip'];
		else
			return 0;
	}
	
	public function update_total_skip_student($test_id, $nis, $total_skip){
		$data = array(
               'total_skip' => $total_skip
            );
		$this->db->where('test_id', $test_id);
		$this->db->where('nis', $nis);
		$this->db->update($this->_table_name, $data); 
	
	}
	
	public function insert_total_skip_student($test_id, $nis, $total_skip){
		$data = array(
			   'test_id' => $test_id,
			   'nis' => $nis,
			   'total_skip' => $total_skip
            );

		$this->db->insert($this->_table_name, $data); 
	}
}
